<template>
  <Table v-bind="$attrs" v-on="$listeners">
    <template v-slot:default="tableData">
      <el-table v-loading="tableData.loading" :data="tableData.list">
        <template v-for="(item, index) in columns">
          <table-column v-if="item.children && item.children.length" :key="index" :center="center" :columns="item" />
          <el-table-column v-else :key="index" :label="item.label" :prop="item.prop" :align="center" />
        </template>
      </el-table>
    </template>
  </Table>
</template>

<script>
import { Table } from "@rabbit.do/rabbit";
import tableColumn from "./tableColumn";
export default {
  components: {
    Table,
    tableColumn,
  },
  props: {
    columns: {
      type: Array,
      required: true,
    },
    center: {
      type: String,
      default: 'center',
    },
  },
  data() {
    return {

    };
  },
};
</script>

<style>
</style>
